package com.iwhalecloud.bss.kite.cucc.web.controller.check;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.iwhalecloud.bss.kite.client.api.scene.query.IQuerySceneFuncProdInstService;
import com.iwhalecloud.bss.kite.client.dto.DataResult;
import com.iwhalecloud.bss.kite.client.dto.cust.ContextCustDTO;
import com.iwhalecloud.bss.kite.client.dto.inst.ProdInstDTO;
import com.iwhalecloud.bss.kite.client.dto.rule.common.DataRuleResult;
import com.iwhalecloud.bss.kite.client.dto.rule.common.DataRuleResultObj;
import com.iwhalecloud.bss.kite.client.dto.rule.common.RuleConsts;
import com.iwhalecloud.bss.kite.common.constant.ErrorConsts;
import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.rule.check.ICheckService;
import com.iwhalecloud.bss.kite.common.util.*;
import com.iwhalecloud.bss.kite.cucc.client.api.customerOrderInformation.UserCenterClient;
import com.iwhalecloud.bss.kite.cucc.client.api.order.IOrderService;
import com.iwhalecloud.bss.kite.cucc.client.api.rule.check.ICuccCheckService;
import com.iwhalecloud.bss.kite.cucc.client.dto.cust.CuccContextCustDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.customerOrderInformation.QryGrpMemberDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.customerOrderInformation.QryGrpMemberListByGrpReq;
import com.iwhalecloud.bss.kite.cucc.client.dto.pos.KitePosDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.scene.CuccCustInfoDTO;
import com.iwhalecloud.bss.kite.cucc.client.vo.scene.WholeQuickEntryVO;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalKeyConsts;
import com.iwhalecloud.bss.kite.cucc.dataservice.cache.OneOffFeeExtOrderInfoCache;
import com.iwhalecloud.bss.kite.cucc.service.cache.LocalWholeQuickEntryCache;
import com.iwhalecloud.bss.kite.cucc.service.shoppingcart.check.ILocalCheckService;
import com.iwhalecloud.bss.kite.cucc.spec.impl.transfer.GoodsInfoTransfer;
import com.iwhalecloud.bss.kite.cucc.web.service.ISceneService;
import com.iwhalecloud.bss.kite.dataservice.cache.OfferCache;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.manager.enums.ActionType;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteOfferInst;
import com.iwhalecloud.bss.kite.manager.inst.KiteProdInst;
import com.iwhalecloud.bss.kite.manager.inst.KiteSceneInst;
import com.iwhalecloud.bss.kite.web.context.KiteWebContext;
import com.iwhalecloud.bss.kite.web.util.RuleParamUtils;
import com.ztesoft.bss.common.exception.BssException;
import com.ztesoft.bss.common.util.SpringUtil;
import com.ztesoft.bss.rul.core.client.dto.common.RuleCommonParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * <Description> 所有的校验规则请求 <br>
 * （由于校验类也会操作事务，内存对象；所以这里有拒绝或者报错的规则，需要抛错来进行回滚任务事务，内存）
 * 目前这个control里的入参都待定，需要调整
 *
 * @author song.jinxiang <br>
 * @version 1.0<br>
 * @date 2019.6.21
 * @see com.iwhalecloud.bss.kite.web.controller.check <br>
 * @since R9.0<br>
 */
@RestController
@RequestMapping("/localCheck")
@Api(tags = { "/localCheck - 本地校验" })
public class LocalCheckController {

    @Autowired
    private ICheckService checkService;

    @Autowired
    IQuerySceneFuncProdInstService querySceneFuncProdInstService;

    @Autowired
    private IQuerySceneInstService querySceneInstService;

    @Autowired
    private ICuccCheckService cuccCheckService;

    @Autowired
    private IOrderService orderService;

    @Autowired
    private ISceneService sceneService;

    @Autowired
    private ILocalCheckService iLocalCheckService;

    @ApiOperation(value = "客户定位校验", notes = "客户定位校验")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "serviceOfferId", value = "服务ID", required = false)
    })
    @PostMapping(value = "/custAuthCheck")
    public DataRuleResult custAuthCheck(
        @RequestParam(required = false) String serviceOfferId) {
        CuccContextCustDTO dto = (CuccContextCustDTO) KiteWebContext.getContext().getCust();
        String custState = dto.getCustState();
        if(!KiteStringUtils.equals(LocalKeyConsts.CUST_STATE_0,custState) && !KiteStringUtils.equals(LocalKeyConsts.CUST_STATE_1,custState)){
            BssException.throwOut("客户状态判断","客户状态不为在网或者潜在，不允许往下受理","客户状态不为在网或者潜在，不允许往下受理");
        }
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        //0708版本暂时不上资源核查页面意向客户的判断
        ruleCommonParam.setServiceOfferId(serviceOfferId);
        return checkService.custAuthCheck(ruleCommonParam);
    }

    @ApiOperation(value="",notes="配置单打印规则校验")
    @PostMapping(value="/checkOnConfigSheetPrint")
    public DataRuleResult checkOnConfigSheetPrint(){
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        String custId = KiteWebContext.getContext().getCustId();
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        return checkService.checkOnConfigSheetPrint(sceneInstId, custId, ruleCommonParam);
    }


    @ApiOperation(value = "设备体验包商品业务变更校验平台类型",notes = "设备体验包商品业务变更校验平台类型")
    @PostMapping(value = "/checkPlatformType")
    public DataRuleResult checkPlatformType(
        @RequestParam(required = false) String userState,
        @RequestParam(required = false) String cbssUserId,
        @RequestParam(required = false) String userName,
        @RequestParam(required = false) String userId,
        @RequestParam(required = false) String  serialNumber){
        String platForm = "";
        String goodsId = "";
        String cateId = "";
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        KiteSceneInst sceneInst = querySceneInstService.getSceneInst(sceneInstId);
        String serviceOfferId = sceneInst.getServiceOfferId();
        String custId = sceneInst.getCustId();
        List<KiteOfferInst> offerInstList =  querySceneInstService.listMainOfferInsts(sceneInstId);
        KiteOfferInst mainOfferInst = offerInstList.stream()
            .filter(dto -> !GoodsInfoTransfer.isAddRoleOffer(dto.getOfferId(), OfferCache.get(dto.getOfferId()).getCateId()) && ActionType.D.equals(dto.getActionType()))
            .findFirst().orElse(null);
        if(Objects.nonNull(mainOfferInst)){
            goodsId = mainOfferInst.getOfferId();
            KiteAttr cateIdAttr = mainOfferInst.getAttr("cateId");
            if (Objects.nonNull(cateIdAttr)){
                cateId = cateIdAttr.getValue();
            }
        }
        if (!KiteStringUtils.equals("2000964", cateId)) {
            DataRuleResult result = new DataRuleResult();
            DataRuleResultObj ruleResultObj = new DataRuleResultObj();
            result.setResultCode(RuleConsts.RULE_RESPONSE_SUCCESS);
            result.setResultObject(ruleResultObj);
            return result;
        }
        KiteProdInst accessProdInst = querySceneInstService.listProdInsts(sceneInstId).stream().filter(kiteProdInst -> ActionType.D.equals(kiteProdInst.getActionType())).findFirst().orElse(null);
        if (Objects.nonNull(accessProdInst)) {
            platForm = accessProdInst.getAttrValue("200004101");
        }
        Map<String,String> reqMap = new HashMap<String,String>();
        reqMap.put("serialNumber", serialNumber);
        reqMap.put("userState", userState);
        reqMap.put("cbssUserId", cbssUserId);
        reqMap.put("userName", userName);
        reqMap.put("userId", userId);
        reqMap.put("goodsId", goodsId);
        reqMap.put("cateId", cateId);
        reqMap.put("serviceOfferId", serviceOfferId);
        reqMap.put("platForm", platForm);
        List paramList = new ArrayList<Map<String,String>>();
        paramList.add(reqMap);
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("prodInstAcctRels", new JSONArray(paramList));
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(custId);
        ruleCommonParam.setParams(paramMap);
        return cuccCheckService.checkPlatformType(sceneInstId,ruleCommonParam);
    }


    @ApiOperation(value = "新增资费规则校验",notes = "新增资费规则校验")
    @PostMapping(value = "/checkAdditionalOfferFee")
    public DataRuleResult checkAdditionalOfferFee(@RequestBody List<String> offerInstIdList){
        String custId = KiteWebContext.getContext().getCustId();
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(custId);
        List<String> checkOfferInstIdList =cuccCheckService.checkOfferInstFeeList(sceneInstId, ruleCommonParam);
        WholeQuickEntryVO wholeQuickEntryVO = LocalWholeQuickEntryCache.get(sceneInstId);
        if(KiteListUtils.isNotEmpty(checkOfferInstIdList)&&null!=wholeQuickEntryVO&&wholeQuickEntryVO.getChecked()==1){
            for(String offerInstId : checkOfferInstIdList){
                List<KiteOfferInst> offerInstList = querySceneInstService.listAdditionalOfferInstsFromMainOfferInst(custId, offerInstId);
                if(KiteListUtils.isEmpty(offerInstList)){
                    continue;
                }
                //排除作废资费
                offerInstList.removeIf(offerInst -> KiteStringUtils.equals(offerInst.getActionType().name(), ActionType.C.name()));
                if(null!=wholeQuickEntryVO&&wholeQuickEntryVO.getKiteAttrs().size()>0){
                    Map<String,String> kiteAttrMap =wholeQuickEntryVO.getKiteAttrs().stream().collect(Collectors.toMap(KiteAttr::getFieldName,KiteAttr::getValue));
                    if(StringUtils.isNotEmpty(kiteAttrMap.get("xieyijia"))){
                        BigDecimal countPrice = BigDecimal.valueOf(Double.valueOf(kiteAttrMap.get("xieyijia").toString()));
                        BigDecimal countPrice1 = new BigDecimal(0); ;
                        for(KiteOfferInst kiteOfferInst:offerInstList){
                            if(offerInstIdList.contains(kiteOfferInst.getOfferInstId())){
                                String value = kiteOfferInst.getAttrMap().get("200000169").getValue();
                                if(null!=value){
                                    BigDecimal bigDecimal = BigDecimal.valueOf(Double.valueOf(kiteOfferInst.getAttrMap().get("200000169").getValue()));
                                    countPrice1 = countPrice1.add(bigDecimal);
                                }
                            }
                        }
                        if(!(countPrice1.compareTo(countPrice) ==0)){
                            ErrorConsts.BUSI_COMMON_ERROR.throwOut("协议价总和不等于全程协议价，请重新填写！");
                        }
                    }
                }
            }
        }

        LocalWholeQuickEntryCache.delete(sceneInstId);
        //返回空的校验结果
       DataRuleResult ruleResult = RuleResponseUtils.cheackRuleResp(null);
        return ruleResult;
    }

    @ApiOperation(value = "加急，延期完成时间规则校验",notes = "加急，延期完成时间规则校验")
    @PostMapping(value = "/checkUrgentOrDelay")
    public DataRuleResult checkUrgentOrDelay(){
        String custId = KiteWebContext.getContext().getCustId();
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(custId);
        return cuccCheckService.checkUrgentOrDelay(sceneInstId, ruleCommonParam);
    }

    @ApiOperation(value="安全产品新增销售品实例校验",notes = "安全产品新增销售品实例校验")
    @PostMapping(value = "/SafeProductOnAddOfferInstCheck")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "sceneInstId", value = "场景实例ID", required = true),
        @ApiImplicitParam(name = "parentOfferInstId", value = "父级销售品实例ID", required = true),
        @ApiImplicitParam(name = "offerId", value = "销售品ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true)
    })
    public DataRuleResult SafeProductOnAddOfferInstCheck(@RequestParam String sceneInstId, @RequestParam String parentOfferInstId,
                                                         @RequestParam String offerId,  @RequestParam String custId){
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(custId);
        List<String> addOfferIdList = new ArrayList<>();
        addOfferIdList.add(offerId);
        Map<String,Object> ruleParamMap = new HashMap();
        ruleParamMap.put("addOfferIdList", addOfferIdList);
        ruleCommonParam.setParams(ruleParamMap);
        DataRuleResult dataRuleResult = cuccCheckService.onAddOfferInstCheck(sceneInstId, ruleCommonParam);
        return dataRuleResult;
    }


    @ApiOperation(value="安全产品删除产品实例校验",notes = "安全产品删除产品实例校验")
    @PostMapping(value = "/SafeProductOnDelProdInstCheck")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "prodInstId", value = "产品实例Id", required = true)
    })
    public DataRuleResult SafeProductOnDelProdInstCheck(@RequestParam String prodInstId){
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        KiteSceneInst sceneInst = querySceneInstService.getSceneInst(sceneInstId);
        List<String> delprodInstIdList = new ArrayList<>();
        delprodInstIdList.add(prodInstId);
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(sceneInst.getCustId());
        Map<String,Object> paramMap = new HashMap<>();
        paramMap.put("delProdInstIdList", delprodInstIdList);
        ruleCommonParam.setParams(paramMap);
        DataRuleResult dataRuleResult = cuccCheckService.SafeProductOnDelProdInstCheck(sceneInstId,ruleCommonParam);
        return dataRuleResult;
    }

    @ApiOperation(value = "新增延期校验", notes = "新增延期校验")
    @PostMapping(value = "/addedDelayCheck")
    @ApiImplicitParams({@ApiImplicitParam(name = "accessProdInstId", value = "接入产品实例标识", required = true),
        @ApiImplicitParam(name = "funcProdId", value = "功能产品标识", required = true)
    })
    public DataResult<Boolean> addedDelayCheck(@RequestParam String accessProdInstId, @RequestParam String funcProdId) {
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        String custId = KiteWebContext.getContext().getCustId();
        List<ProdInstDTO> funcProdList = Lists.newArrayList();
        List<ProdInstDTO> prodInstList = querySceneFuncProdInstService
            .listFuncProdInstByProdInstId(sceneInstId, accessProdInstId, custId).getResultObject();
        if (KiteListUtils.isNotEmpty(prodInstList)) {
            funcProdList = prodInstList.stream().filter(
                prodInst -> prodInst.getProdId().equals(funcProdId) && KiteStringUtils
                    .isNotEmpty(prodInst.getActionType()) && prodInst.getActionType().equals(KeyConsts.ACTION_TYPE_A))
                .collect(Collectors.toList());
        }
        if (KiteListUtils.isNotEmpty(funcProdList)) {
            return ErrorConsts.SUCCESS.getResult(false);
        }
        else {
            return ErrorConsts.SUCCESS.getResult(true);
        }
    }


    @ApiOperation(value="收入归集集团删除校验",notes = "收入归集集团删除校验")
    @PostMapping(value = "/memberDelCheck")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "accNum", value = "收入归集集团业务号码", required = true)
    })
    public DataRuleResult memberDelCheck(@RequestParam String accNum){
        String cateId = "";
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        KiteSceneInst sceneInst = querySceneInstService.getSceneInst(sceneInstId);
        String serviceOfferId = sceneInst.getServiceOfferId();
        List<KiteOfferInst> offerInstList =  querySceneInstService.listMainOfferInsts(sceneInstId);
        KiteOfferInst mainOfferInst = offerInstList.stream()
            .filter(dto -> !GoodsInfoTransfer.isAddRoleOffer(dto.getOfferId(), OfferCache.get(dto.getOfferId()).getCateId()) && ActionType.D.equals(dto.getActionType()))
            .findFirst().orElse(null);
        if(Objects.nonNull(mainOfferInst)){
            KiteAttr cateIdAttr = mainOfferInst.getAttr("cateId");
            if (Objects.nonNull(cateIdAttr)){
                cateId = cateIdAttr.getValue();
            }
        }
        UserCenterClient userCenterClient = SpringUtil.getBean(UserCenterClient.class);
        QryGrpMemberListByGrpReq qryGrpMemberListByGrpReq = new QryGrpMemberListByGrpReq();
        qryGrpMemberListByGrpReq.setPrimarySerialNumber(accNum);
        qryGrpMemberListByGrpReq.setCurPage(1);
        qryGrpMemberListByGrpReq.setPageSize(1);
        PageInfo<QryGrpMemberDTO> qryGrpMemberDTOPageInfo = userCenterClient
            .qryGrpMemberListByGrp(qryGrpMemberListByGrpReq);
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam(sceneInst.getCustId());
        Map<String,Object> paramMap = new HashMap<>();
        List<Map> objects = new ArrayList<>();
        if(Objects.nonNull(qryGrpMemberDTOPageInfo.getList())){
            List<QryGrpMemberDTO> list = qryGrpMemberDTOPageInfo.getList();
            for (QryGrpMemberDTO qryGrpMemberDTO : list) {
                Map map = JSONObject.parseObject(JSONObject.toJSONString(qryGrpMemberDTO),Map.class);
                objects.add(map);
            }
        }
        paramMap.put("delAccNumList",objects);
        paramMap.put("accNum", accNum);
        paramMap.put("serviceOfferId", serviceOfferId);
        paramMap.put("cateId", cateId);
        ruleCommonParam.setParams(paramMap);
        DataRuleResult dataRuleResult = cuccCheckService.memberDelCheck(sceneInstId,ruleCommonParam);
        return dataRuleResult;
    }

    @ApiOperation(value = "趸交订单缴费规则校验", notes = "趸交订单缴费规则校验")
    @PostMapping(value = "/singlePaymentFeePayChargeCheck")
    public DataRuleResult singlePaymentFeePayChargeCheck(@RequestParam String orderId, @RequestParam String serialNumber, @RequestParam String amount) {
        KitePosDTO kitePosDTO = OneOffFeeExtOrderInfoCache.get(orderId);
        if (Objects.isNull(kitePosDTO)) {
            Map<String, Object> orderInfoMap = orderService.getOrderDetail(orderId);
            kitePosDTO = JSONObject.toJavaObject(JSON.parseObject(JSON.toJSONString(orderInfoMap)), KitePosDTO.class);
            kitePosDTO.getGoods().removeIf(goods -> goods.getProducts().stream().anyMatch(prod -> KiteStringUtils.equals(prod.getType(), "discount")));
            OneOffFeeExtOrderInfoCache.getInst().defaultPut(orderId, kitePosDTO);
        }
        if (Objects.nonNull(kitePosDTO)) {
            this.sceneService.initContext(kitePosDTO.getCustomer());
        }
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        if (Objects.isNull(ruleCommonParam.getParams())) {
            ruleCommonParam.setParams(new HashMap<>());
        }
        ruleCommonParam.getParams().put("orderId", orderId);
        DataRuleResult ruleResult = cuccCheckService.singlePaymentFeePayChargeCheck(amount, serialNumber, ruleCommonParam);
        return ruleResult;
    }


    @ApiOperation(value="",notes="订单预览规则校验")
    @PostMapping(value="/checkOnOrderPreview")
    public DataRuleResult checkOnOrderPreview(){
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        String custId = KiteWebContext.getContext().getCustId();

        // 客户信息的省份信息
        ContextCustDTO contextCustDTO = KiteWebContext.getContext().getCust();
        CuccCustInfoDTO cuccCustInfoDTO = KiteBeanUtils.transform(contextCustDTO, CuccCustInfoDTO.class);
        String provinceCode = cuccCustInfoDTO.getProvinceCode();
        String eparchyProvince = cuccCustInfoDTO.getEparchyProvince();
        Map<String, Object> paramMap = new HashMap<>();
        paramMap.put("custInfoProvinceCode", provinceCode);
        paramMap.put("custInfoEparchyProvince", eparchyProvince);

        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        ruleCommonParam.setParams(paramMap);
        return cuccCheckService.checkOnOrderPreview(sceneInstId, custId, ruleCommonParam);
    }

    @ApiOperation(value="",notes="订单预览规则校验")
    @PostMapping(value="/cuccCheckOnOrderPreview")
    public DataRuleResult cuccCheckOnOrderPreview(){
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        String custId = KiteWebContext.getContext().getCustId();
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        return cuccCheckService.cuccCheckOnOrderPreview(sceneInstId, custId, ruleCommonParam);
    }

    @ApiOperation(value="",notes="订单预览Common规则校验")
    @PostMapping(value="/cuccCheckOnOrderPreViewCommon")
    public DataRuleResult checkOnOrderPreViewCommon(){
        String sceneInstId = KiteWebContext.getContext().getCurrentSceneInstId();
        String custId = KiteWebContext.getContext().getCustId();
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        return cuccCheckService.cuccCheckOnOrderPreViewCommon(sceneInstId, custId, ruleCommonParam);
    }

    @ApiOperation(value="设置付费关系校验",notes = "设置付费关系校验")
    @PostMapping(value = "/PIARPayMemberCheck")
    public DataRuleResult PIARPayMemberCheck(@RequestParam(required = false) String cbssAccountCode, @RequestParam(required = false) String provinceCode){
        RuleCommonParam ruleCommonParam = RuleParamUtils.getRuleParam();
        List acctRelList = new ArrayList<>();
        Map acctRelMap = new HashMap();
        acctRelMap.put("cbssAccountCode",cbssAccountCode);
        acctRelMap.put("provinceCode",provinceCode);
        acctRelMap.put("actionType","S");
        acctRelList.add(acctRelMap);
        if (Objects.isNull(ruleCommonParam.getParams())) {
            ruleCommonParam.setParams(new HashMap<>());
        }
        ruleCommonParam.getParams().put("prodInstAcctRels", acctRelList);
        DataRuleResult dataRuleResult = cuccCheckService.PIARPayMemberCheck(ruleCommonParam);
        return dataRuleResult;
    }

    @ApiOperation(value = "查询结果配置：查看草稿和待提交订单", notes = "查询结果配置：查看草稿和待提交订单;1表示选择，0表示取消")
    @PostMapping(value = "/qryResultConfig")
    public DataResult resultConfig(@RequestParam Integer check) {
        if (check == null) {
            check = 0;
        }
        return iLocalCheckService.resultConfig(check);
    }

    @ApiOperation(value = "查询结果配置：查看草稿和待提交订单", notes = "查询结果配置：查看草稿和待提交订单;1表示选择，0表示取消")
    @GetMapping(value = "/qryResultConfig")
    public DataResult getResultConfig() {
        return iLocalCheckService.getResultConfig();
    }

}
